//add
function popAddPage() {
    $.ajax({
        type: "post",
        url: '/server-group-list1',
        success: function (data) {
            var serverGroup = JSON.parse(data);
            $('#selectGroup').empty();
            for (var i = 0; i < serverGroup.length; i++) {
                $('#selectGroup').append("<option value='" + serverGroup[i].id + "'>" + serverGroup[i].name + "</option>");
            }
            $('#addserver').on('show');
        },
        error: function (data) {
            alert("error！")
        }
    });
}

//update
function popUpdatePage(id, name, remark, ip, port, groupId) {
    //加载分组服务下来列表
    $.ajax({
        type: "post",
        url: '/server-group-list1',
        success: function (data) {
            var serverGroup = JSON.parse(data);
            $('#uselectGroup').empty();
            for (var i = 0; i < serverGroup.length; i++) {
                if (serverGroup[i].id == groupId) {
                    $('#uselectGroup').append("<option selected='selected' value='" + serverGroup[i].id + "'>" + serverGroup[i].name + "</option>");
                } else {
                    $('#uselectGroup').append("<option value='" + serverGroup[i].id + "'>" + serverGroup[i].name + "</option>");
                }

            }
            $('#id').val(id);
            $('#uname').val(name);
            $('#uremark').val(remark);
            $('#uip').val(ip);
            $('#uport').val(port);
            $('#changeserver').on('show');
        },
        error: function (data) {
            alert("error！")
        }
    });
}